#!/usr/bin/python3
# coding: utf-8
# file: requests_.py
# 2018-06-12
import requests

user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
urls = [
    'http://httpbin.org/ip',
    'http://httpbin.org/user-agent',
    'http://httpbin.org/headers'
]
proxies = {
	'http': "133.130.124.30:8181",
}

def fetch(url, proxies=None):
	'''http请求页面'''
	s = requests.Session()
	s.headers.update({'User-Agent': user_agent})
	resp = s.get(url, proxies=proxies, timeout=3)
	print(resp.text)

def example():
	for url in urls:
		fetch(url)



if __name__ == '__main__':
	example()
